#include "visualkukarobotinstance.h"
#include "visualkukarobotinstance_global.h"

static VisualKUKARobotInstance* pVisualKUKARobotInstance = nullptr;

short PLU_KPluginInstanceCreate(short Local_Remote){
    if(pVisualKUKARobotInstance == nullptr){
        pVisualKUKARobotInstance = new VisualKUKARobotInstance(Local_Remote);
    }
    return 1;
}

short PLU_KPluginInstanceDelete(){
    if(pVisualKUKARobotInstance != nullptr){
        delete pVisualKUKARobotInstance;
    }
    return 1;

}

bool PLU_KPluginInstanceExists(){
    if(pVisualKUKARobotInstance != nullptr) return true;
    else                                 return false;
}

QWidget* PLU_KPluginInstanceUiRegesiter(){
    return pVisualKUKARobotInstance->getUiHandle();

}

void TASK_kukaloop_KUKADataProcess(){
    if(pVisualKUKARobotInstance != nullptr){
        pVisualKUKARobotInstance->task_kukaloop_KUKAProcess();
    }
}

void TASK_maininit_ForceSensorConnect(){
    if(pVisualKUKARobotInstance != nullptr){
        pVisualKUKARobotInstance->task_maininit_ForceSensorConnect();
    }
}

void TASK_mainloop_ForceSensorLoopRun(){
    if(pVisualKUKARobotInstance != nullptr){
        pVisualKUKARobotInstance->task_mainloop_ForceSensorLoopRun();
    }
}

void TASK_maininit_LaserSensorConnect(){
    if(pVisualKUKARobotInstance != nullptr){
        pVisualKUKARobotInstance->task_maininit_LaserSensorConnect();
    }
}

void TASK_mainloop_LaserSensorLoopRun(){
    if(pVisualKUKARobotInstance != nullptr){
        pVisualKUKARobotInstance->task_mainloop_LaserSensorLoopRun();
    }
}

void TASK_uifast_ForceScopeUpdate(){
    if(pVisualKUKARobotInstance != nullptr){
        pVisualKUKARobotInstance->task_uifast_ForceScopeUpdate();
    }
}

void TASK_uifast_LaserScopeUpdate(){
    if(pVisualKUKARobotInstance != nullptr){
        pVisualKUKARobotInstance->task_uifast_LaserScopeUpdate();
    }
}

void TASK_uifast_RobotScopeUpdate(){
    if(pVisualKUKARobotInstance != nullptr){
        pVisualKUKARobotInstance->task_uifast_RobotScopeUpdate();
    }
}

void TASK_RemoteDataRecv(QByteArray Data){
    if(pVisualKUKARobotInstance != nullptr){
        pVisualKUKARobotInstance->task_com_RemoteDataRecv(Data);
    }
}

void TASK_RemoteDataSend(QByteArray& Data){
    if(pVisualKUKARobotInstance != nullptr){
        pVisualKUKARobotInstance->task_com_RemoteDataSend(Data);
    }
}

void TASK_uifast_UiDataUpdate(){
    if(pVisualKUKARobotInstance != nullptr){
        pVisualKUKARobotInstance->task_uifast_UiDataUpdate();
    }
}
